<?php

class SaltHelper extends CApplicationComponent
{
    public function getRand()
    {
        return $this->randomWord();
    }

    public function getHash($message='')
    {
        return hash('md5', $message.Yii::app()->params['salt']);
    }

    protected function randomWord($length=0)
    {
        if(!$length) $length=rand(10,16);
        $chars=array_merge(range('a','z'),range(0,9));
        shuffle($chars);
        return implode(array_slice($chars,0,$length));
    }
}